#!/use/bin/python
# coding=utf-8
# 主动服务 开机率 analysis_startup_rate
import datetime
import pymysql

from dbutils.pooled_db import PooledDB



# proactive_service_conf 数据源
def getConfConnection():
    # 开发环境
    # pool = PooledDB(pymysql, 1, host='172.20.135.96', user='pushdb', passwd='SkYWOrTh$TcOs',
    #                db='proactive_service_conf',
    #                port=3306)  # 1为连接池里的最少连接数
    # 测试环境
    pool = PooledDB(pymysql, 1, host='172.20.150.110', user='test_movie', passwd='movie20189933',
                db='cc_media_source', port=4308)  # 1为连接池里的最少连接数
    # pool = PooledDB(pymysql,1,host='127.0.0.1',user='root',passwd='root',db='life_assistant_data',port=3306) # 5为连接池里的最少连接数
    conn = pool.connection()
    cur = conn.cursor()
    return conn, cur


def selectBigData():
    try:
        conn, cur = getConfConnection()
        selectSql = "select t.name from cc_smart_prompt t  where t.id = 1"
        cur.execute(selectSql)
        res = cur.fetchone()
        print("------------------ku9_kanban_device_active_pay_day", res[0], "--------------------------")
    except Exception as e:
        print(e)

    finally:
        cur.close()
        conn.close()

if __name__ == '__main__':
    selectBigData();